# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=Test-Warnings
pkgname=perl-${_realname}
pkgver=0.026
pkgrel=1
pkgdesc="Test for warnings and the lack of them"
arch=('any')
url="https://search.mcpan.org/dist/Test-Warnings"
license=('GPL' 'PerlArtistic')
depends=('perl')
options=('!emptydirs')
groups=('perl-modules')
source=("https://search.mcpan.org/CPAN/authors/id/E/ET/ETHER/${_realname}-${pkgver}.tar.gz")
sha256sums=('ae2b68b1b5616704598ce07f5118efe42dc4605834453b7b2be14e26f9cc9a08')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='"${pkgdir}"'"     \
      PERL_MB_OPT="--installdirs vendor --destdir '"${pkgdir}"'" \
      PERL_USE_UNSAFE_INC=1 \
      MODULEBUILDRC=/dev/null

    cd "${srcdir}/${_realname}-$pkgver"
    /usr/bin/perl Makefile.PL
    make
  )
}

check() {
  cd ${_realname}-${pkgver}
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
    make test
  )
}

package() {
  cd ${_realname}-${pkgver}
  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}
